#coding:utf8
# win-raw-in库的_usb_ids.py 下面这部分，需要加errors='ignore'
"""with open(os.path.join(os.path.dirname(__file__), 'usb.ids'), 'r', errors='ignore') as usb_ids_file:
    DATABASE = usb_ids_file.read()
"""
import winrawin
import tkinter as tk

def handle_event(e: winrawin.RawInputEvent):
    if e.event_type == 'move':
        return
    print(f"Pressed {e.name} on {e.device_type} {e.device.handle}")
        
    
window = tk.Tk()
winrawin.hook_raw_input_for_window(window.winfo_id(), handle_event)
window.mainloop()